package com.powernode.controller;

import com.powernode.domain.Area;
import com.powernode.model.Result;
import com.powernode.service.AreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author RenBoQing
 * @date 2024年08月04日 18:56
 * @Description 门店地址控制器
 */
@RestController
@RequestMapping("/admin/area/")
@Api(tags = "地区业务管理接口")
public class AreaController {
    @Autowired
    private AreaService areaService;

    /**
     * 获取所有门店地址
     * @return
     */
    @ApiOperation("获取全国的地址列表")
    @GetMapping("/list")
    @PreAuthorize("hasAuthority('admin:area:list')")
    public Result<List<Area>> getAllAreaList() {
        List<Area> list = areaService.getAllAreaList();
        return Result.success(list);
    }
}
